{% extends "base_site.html" %}
{% load static %}

{% block title %}Rolodex - Add{% endblock %}

{% block extrahead %}{{ block.super }}
    <script src="{% static 'secr/js/utils.js' %}"></script>
{% endblock %}

{% block breadcrumbs %}{{ block.super }}
    &raquo; <a href="../">Rolodex</a>
    &raquo; Add
{% endblock %}

{% block content %}

    {% if results %}

        <ul class="errorlist"><li>Please take a minute to search the list below to prevent creating a duplicate record</li></ul>

        <div class="module">
            <h2>Adding {{ name }} </h2>

            <form id="rolodex-add-form" enctype="multipart/form-data" action="{% url "ietf.secr.rolodex.views.add_proceed" %}" method="post">{% csrf_token %}
                <div>{{ form.as_p }}</div>
                {% include "includes/search_results_table.html" %}

                <div class="button-group">
                    <ul>
                        <li><button type="button" onclick="history.go(-1);return true">Back</button></li>
                        <li><button type="submit" name="submit" value="Continue">Continue</button></li>
                    </ul>
                </div> <!-- button-group -->
            </form>
        </div> <!-- module -->

    {% else %}

        <div class="module">
            <h2>Name</h2>
            <form id="rolodex-add-form" enctype="multipart/form-data" method="post">{% csrf_token %}
                <table class="full-width amstable">
                    <tbody>
                    <!-- [html-validate-disable-block wcag/h63 -- FIXME: as_table renders without scope] -->
                    {{ form.as_table }}
                    </tbody>
                </table>

                {% include "includes/buttons_proceed.html" %}

            </form>
        </div> <!-- module -->

    {% endif %}

{% endblock %}
